home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Tools 1993 October - Disc 2
/
Power Tools (Disc 2)(October 1993)(HP).iso
/
hotlines
/
ccsyhl
/
sisaparc
/
sisaparc.txt
Wrap
Text File
|
1993-05-21
|
15KB
|
328 lines
HP Software Integration Sockets
Adapter Architecture
1.0 Introduction
HP Software Integration Sockets Adapter Architecture describes a robust
architec ture for writing a flexible full functioned HP Sockets adapter
for your application. The rest of this document defines the functional
overview of a "receive" a dapter and the configuration mechanism for
the messages the adapter receives, a short overview of a "send"
adapter, and a description of two adapters available for you to test
your adapter under development.
2.0 Architecture Philosophy
To help you get started more quickly on your HP Sockets adapter, we
have defined general "receive" and "send" adapter architectures that
have been successfully used to create application adapters. In addition
to giving you a general flow to follow, if your adapter conforms to
this outline it will be configurable and plug ready for an HP Sockets-
based integrated solution.
3.0 "Receive" Adapter Architecture
The functional flow of a "receive" adapter should be:
1. Initialize any global variables, path names, etc.
2. Initialize a signal for the stop routine. This will make sure
communication with HP Sockets is terminated gracefully when the
interrupt signal is received to stop the adapter.
3. Read in the adapter\xd5s configuration file. This is a file separate
from the six HP Sockets configuration files. The purpose of this file
is to define in one place the types of transactions the adapter can
receive and the output form at strings to convert the incoming message
data into a command for the application.
4. Initialize communication between the adapter and HP Sockets.
5. Process incoming messages in an infinite loop:
Extract the message type, function and data items from the message. Get
the transaction entry for the message from the adapter's configuration
information. Use the output format strings from the configuration to
format the message data which is written to the output buffer. Send the
output buffer to the application using its data import mechanisms.
Throughout this flow, status and error messages are written to a log
file (named XXX.lg where XXX is the name of the adapter). The following
diagram illustrates this functional flow.
3.1 Incoming Messages
All incoming messages to a "receive" adapter must follow the standard
message format described in HP Software Integration Sockets Standard
Message Format. These messages consist of a single ASCII string with
fields separated by a configurable delimiter. All adapters should
define the constant INPUT_DATA_DELIM to be the particular delimiter
character. When an integrated solution is being created by plugging
various adapters together, the delimiter can be changed by altering the
value of the constant in each of the adapters and re-compiling. All
adapters in an HP Sockets- based integrated solution must be using the
same delimiter to interoperate. The Request messages (message type
REQM) and Sent messages (message type SENTM) to be handled by a
"receive" adapter are defined in its configuration file which is
described in section 3.3.
3.2 Message Sequencing
In the case of a multiple message transaction, we want to be sure not
to intersperse messages from different transactions within the
"receive" adapter. To do this, the main SpReadQ call reads an incoming
message from any adapter (that is, it uses a NULL ProcessLn parameter).
If the message is the first in a multiple message transaction, a
subsequent SpReadQ call is made to read messages only fro m the adapter
that sent the first message in the transaction (by setting the
ProcessLn parameter to the name of the adapter that sent the first
message). After the final message in the transaction is received, the
adapter returns to reading messages from any adapter.
3.3 Adapter Configuration File
The adapter configuration file defines the transactions that the
adapter can per form. It is an ASCII file that is read into memory when
the adapter is started. Its purpose is to provide a way to configure
the adapter without having to hardcode the various transactions it
supports. The configuration file can contain comments and transaction
entries. Comments start with a # in column 0. All other lines are
assumed to be part of a transaction entry. This file is generally named
XXX.config where XXX is the name of the adapter.
The general format of a transaction entry in the adapter configuration
file is:
# Comments start with a # in column 0. No blank lines are
allowed. #
FunctionName NumberOfHeaderLines NumberOfRepeatLines
FinalFunctionName
"HeaderMessageFormatLines" "RepeatMessageFormatLines"
"EndMessageFormatLines"
Each transaction entry consists of the following information:
Function Name - the name for this transaction entry. The
value of the Function field (the second field) in the standard message
format will be matched with this name to choose the correct entry.
Final Function Name - the Function Name that will appear in the
final message if this is a multiple message transaction. It must begin
with a capital letter in the configuration file. This field is not
required if the transaction consists of a single message. Message
format lines - instructions for how to format the data received in the
message to create a command to send to the application. It consists of
three types of format lines to give you the most flexibility in
adapting to the input syntax of the application you are writing the
adapter for. Each format line is similar in syntax to the C printf
function format stringand is enclosed within double quotes. The string
can contain literal ASCII characters which are passed through to the
output unchanged plus the following special formatting characters which
are replaced with data from the incoming message before being output.
The special format characters are:
- ^ - replaced with a new line - %f - replaced with the
Function from the message - %r - replaced with the Adapter
Name from the message - %xx - replaced by a function specific
field from the message where xx is an integer representing
which function specific field. %0 is replaced by the
first field, %1 by the second field, etc.
The three types of format lines are:
Header Message Format Lines - use for the opening part of the
command. These header lines are output at the beginning of the
transaction when the first message is received.
Repeat Message Format Lines - use for the data in the command.
These repeat lines are output for each message in a transaction except
for the final message.
End Message Format Lines - use for the closing part of the
command. These end lines are output at the end of the transaction when
the final message in the transaction is received.
Number Of Header Lines - how many of the message format lines in this
transaction entry are header lines.
Number Of Repeat Lines - how many of the message format lines following
the header lines are repeat lines.
The general format of a transaction entry in the adapter configuration
file is:
# Comments start with a # in column 0. No blank lines are
allowed. #
FunctionName NumberOfHeaderLines NumberOfRepeatLines
FinalFunctionName
"HeaderMessageFormatLines" "RepeatMessageFormatLines"
"EndMessageFormatLines"
3.3.1 Example
Here is a sample entry in an adapter configuration file:
# Entry for Function Func Func 1 1 FuncEND
"@@batchload func.p^" "%f^%0 %2 %1 %r^"
".^@@end^"
If the three following input messages are received by the adapter:
SENTM|Func|process1|1.0|2.3|4.5|
SENTM|Func|process1|2.3|6.7|9.8|
SENTM|FuncEND|process1|
The individual message fields for the first message would be parsed
as:
Message Type = SENTM Function = Func
Adapter Name = process1 Data0 = 1.0 Data1
= 2.3 Data2 = 4.5
And the resulting output format lines would be the following:
@@batchload func.p <---
header line "Func"
<--- repeat line "1.0" "4.5" "2.3" "process1"
"Func"
<--- repeat li ne
"2.3" "9.8" "6.7" "process1" .
<--- end
line @@end <--- end line
4.0 "Send" Adapter Architecture
A "send" adapter is started only when there is data to send from the
adapter's application to another application. When the adapter is
started, it gets the data from the application, formats it into the
standard message format, sends the message(s) using HP Sockets and the
SpSendMsg access routine, and stops.
5.0 Test Adapters
Two HP Sockets adapters have been written to help you test your adapter
under development if it uses the standard message format described in
HP Software Integration Sockets Standard Message Format. The two
adapters are send_test and recv_ test. Send_test allows you to easily
enter all of the elements of an HP Sockets message, along with the name
of the destination adapter. It then formats the input data into an HP
Sockets message, sends the message to the adapter being tested, and
writes a copy of the message to its log file, send_test.lg. You may
optionally specify the name of an adapter to be started to capture the
return message from the adapter under test. Recv_test is an optional
adapter to use to capture the return message, display it on the screen,
and write it to its log file (recv_test.lg) for further review.
5.1 How to use them
The adapter under test, the send_test and recv_test adapters, and
their log files must all be in the same directory. The environment
variable ADAPTOR_PATH must be set to the full path name of this
directory. To start send_test simply type send_test. You will then be
prompted for the following items. The previously entered value for that
prompt is always displayed. If you wish to retain the same value,
simply hit the carriage return (<cr>) to keep that value.
1. Return Adapter Name - This is the name of the adapter that should
be started to capture any messages generated in response to the message
sent to the adapter under test. Typically this would be the adapter
recv_test. This is only entered once for each invocation of send_test.
This is an optional item. If your test adapter does not generate return
messages, or you do not wish to receive them , just enter <cr> at this
prompt.
2. Message Type - This is the message type field of the HP Sockets
standard mess age format. Enter one of REQM, SENTM, or ERROR. Enter
ENDENDEND to stop send _test.
3. Function Name - This is the Function field of the HP Sockets
standard message format. It should be one of the Functions the adapter
under test understands.
4. Adapter Name - The name of this test adapter. This is used in the
SpInit call to initialize communication between the send_test process
and HP Sockets. Use a name that is configured in your Process
Definition file.
5. Destination Adapter Name - The name of the adapter the message is to
be sent to - the adapter under test.
6. Data Items - Up to 10 data items that are the function specific data
for the Function. The order of the entries is significant since they
are used to replace the %xx parameters in the configuration message
format lines. If you wish to skip a data item, simply hit <cr>. The
send_test adapter can be modified to ask for more than 10 data items if
your adapter under test requires that.
After entering all of the data, it will be displayed and you will be
asked if it is correct. If so, enter Y <cr> and the message will be
formatted, sent to the destination adapter, and written to the log
file. If it is incorrect, enter N <cr>, you will get a chance to
correct all of the values. Simply hit <cr> for the items that are
already correct.
After the message is sent, you will be back at the prompt for the
Message Type. Enter the data for the next test message or ENDENDEND to
stop the program.
6.0 Sample Code
A sample receive and send adapter is available along with the source
code to the send_test and recv_test adapters. Contact the HP Sockets
Program to receive a tape. The tape contains the following files:
makefile - Run "make" to use this file to create all four of the
sample adapter s.
MRP.c - Source code to the MRP "receive" adapter. Test this
adapter with the s end_test program. Start MRP and then start send_test
answering the questions it asks about the message you want to send to
MRP. Here is a sample script for th e send_test adapter to send a
message to MRP:
Enter the optional RETURN ADAPTOR name or <cr> (): <cr> Enter
the MESSAGE type (): REQM Enter the FUNCTION name (): OpParts
Enter this ADAPTOR\xd5s name (): send_test Enter the
DESTINATION ADAPTOR name (): MRP Enter DATA ITEM #0 (): 1 Enter
DATA ITEM #1 (): 2 Enter DATA ITEM #2 (): 3 Enter DATA ITEM #3
(): 4 Enter DATA ITEM #4 (): 5 Enter DATA ITEM #5 (): 6 Enter
DATA ITEM #6 (): 7 Enter DATA ITEM #7 (): 8 Enter DATA ITEM #8
(): 9
MESSAGE type : REQM FUNCTION name
: OpParts ADAPTOR name : send_test
DESTINATION ADAPTOR : MRP DATA ITEM #0 :
1 DATA ITEM #1 : 2 DATA ITEM #2
: 3 DATA ITEM #3 : 4 DATA ITEM #4
: 5 DATA ITEM #5 : 6 DATA ITEM #6
: 7 DATA ITEM #7 : 8 DATA ITEM #8
: 9
Are these data values correct? (y/n): y Output buffer
from send_test is: REQM|OpParts| |1|2|3|4|5|6|7|8|9
And the corresponding output from MRP when it receives this message is:
@@batchload cmdc.p "OpParts" "1" "2"
"" . @@end
MRP.config - Adapter configuration file for the MRP adapter.
It defines all of the transactions the adapter can process.
MRPSEND.c - Source code to the MRP "send" adapter.
recv_test.c - Source code to the receive test adapter.
send_test.c - Source code to the send test adapter.
Netw.def - Network Definition file containing a configuration that will
run the MRP, send_test, and recv_test adapters. Alter this file so it
reflects the correct networking information for the machine you are
running these adapters on.
Proc.def - Process Definition file containing a configuration that will
run the MRP, send_test, and recv_test adapters. Alter this file if you
change the logical node name of the machine the adapters will run on or
if you change the logical name of any of the adapters.